package com.roc.steelend.controller;


import com.roc.steelend.service.WriteOffBuyDetailService;
import com.roc.steelend.service.WriteOffKaipingDetailService;
import com.roc.steelend.service.WriteOffSaleDetailService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigInteger;
import java.util.HashMap;
import java.util.List;

@RestController
@CrossOrigin
@Api(tags = "订单收付款细节功能接口")
public class WriteOffController {

    @Autowired
    private WriteOffBuyDetailService writeOffBuyDetailService;
    @Autowired
    private WriteOffSaleDetailService writeOffSaleDetailService;
    @Autowired
    private WriteOffKaipingDetailService writeOffKaipingDetailService;

    /**
     * 采购查询付款细节
     */
    @GetMapping("/v1/buy/detail/pay")
    public List<HashMap<String,Object>> buyDetailByPay(@RequestParam(required = true) BigInteger buyOrderId){
        return writeOffBuyDetailService.buyDetailByPay(buyOrderId);
    }


    /**
     * 销售查询付款细节
     */
    @GetMapping("/v1/sale/detail/pay")
    public List<HashMap<String,Object>> saleDetailByPay(@RequestParam(required = true)BigInteger saleOrderId){


        return writeOffSaleDetailService.saleDetailByPay(saleOrderId);

    }


    /**
     * 开平查询付款细节
     */
    @GetMapping("/v1/kaiping/detail/pay")
    public List<HashMap<String,Object>> kaipingDetailByPay(@RequestParam(required = true)BigInteger kaipingOrderId){


        return writeOffKaipingDetailService.kaipingDetailByPay(kaipingOrderId);

    }
}
